<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <soncpn></soncpn>
    </div>
</body>

<template id="soncpn">
    <div>
        <h1>我是子组件</h1>
        <button @click="btnClick">打印父组件</button>
    </div>
</template>
<script src="../js/http_cdn.bootcdn.net_ajax_libs_vue_2.6.6_vue.js"></script>
<script>
    const soncpn = {
        template:"#soncpn",
        methods: {
            btnClick(){
                console.log(this.$parent)
            }
        },
    }

    new Vue({
        el: "#app",
        components: {
            soncpn
        }
    })
</script>

</html>
